#ifndef	_GUI_H
#define	_GUI_H
#include "resource.h"
#include "graph.h"

typedef	enum _win_type {
	WIN_DLG = 0,
	WIN_EDIT,
	WIN_BUTTON,
	WIN_SCROLLBAR,
	WIN_PROGRESSBAR,
	WIN_SEPERATOR,
	WIN_CHECKBOX
} win_type_t;

typedef	enum _status {
	STATUS_INACTIVE,
	STATUS_ACTIVE
} status_t;

struct window {
	/* parent pointer */
	const struct window *parent;
	/* window id */
	window_id_t	id;
	/* window type */
	win_type_t	type;
	/* region */
	struct rect 	rect;
	/* draw function(it not must be implete) */
	void (* draw)(const struct window *win);
	void (* func)(const struct window *win);
	/* the control infomation */
	void *info;
	/* the need of the list */
	struct window *next;
	struct window *child;
};


/* ------------------------------------------------------------------ */
/*                              scrollbar                             */
/* ------------------------------------------------------------------ */
struct scrollbar {
	struct point	start_pt;
	u32		height;
	struct rect	button_up;
	struct rect	button_down;

	u32		nr_total;
	u32		nr_perpage;
	u32		pos;
};
/* ------------------------------------------------------------------ */
/*                              progressbar                           */
/* ------------------------------------------------------------------ */
struct progressbar {
	struct point 	start_pt;
	u32		length;

	u32		nr_total;
	u32		nr_status;
};
/* ------------------------------------------------------------------ */
/*                              seperator                             */
/* ------------------------------------------------------------------ */
struct seperator {
	struct point 	start_pt;
	u32		length;
};
/* ------------------------------------------------------------------ */
/*                           edit control                             */
/* ------------------------------------------------------------------ */
struct edit {
	struct rect rt;
	char *buff;
};

/* ------------------------------------------------------------------ */
/*                            check box                               */
/* ------------------------------------------------------------------ */
struct check_box {
	struct point start_pt;
	u32	checked;
	char *caption;
};

/* ------------------------------------------------------------------ */
/*                              func prototype			      */
/* ------------------------------------------------------------------ */

void gui_init(void);
void draw_button_rect(const struct rect *rect, status_t status, draw_model_t model);
window_id_t gui_draw_window(struct window *win);
struct window* gui_create_window(struct window *parent, u16 x, u16 y, u16 length, u16 width,
			       win_type_t type, const char *caption,
				void (*draw)(const struct window *),
				void (*func)(const struct window *));
void gui_handle(void);
#endif
